<?php
namespace app\mini\controller;
class Role extends Pre
{
    //获取我能开出的所有职位
    public function allRole(){
        $loginInfo = $this -> loginInfo->roleInfo;
        $power = explode(',',$loginInfo['power']);
        $allPower = $power;
        do{
            $findRole[] = ['id','in',$power];
            $findPower = \app\common\model\Role::where($findRole)->column('power');
            $power = [];
            foreach ($findPower as $value){
                $powerPre = $value?explode(',',$value):'';
                if ($powerPre)
                    $power = array_merge($power,$powerPre);
            }
            if ($power)
                $allPower = array_merge($allPower,$power);

        }while($power);
        $info = \app\common\model\Role::where('id','in',$allPower)->where('id','neq',33)->field('id,rolename')->select();
        return $info;
    }

}